iT邦幫忙

2025 iThome 鐵人賽

DAY 3
0
AI & Data

Rosalind 生物資訊解題系統系列 第 3

Day03 | Rosalind 生資解題 - IN2. Variables and Some Arithmetic

  • 分享至 

  • xImage
  •  

Day03 | Rosalind 生資解題 - IN2. Variables and Some Arithmetic

題目連結:https://rosalind.info/problems/ini2/

https://ithelp.ithome.com.tw/upload/images/20250914/20125192IIsX9YZ62R.png

給直角三角形的兩個邊a, b,求斜邊(hypotenuse)的平方(square)

輸入

3 5

輸出

34

3, 5 => 3^2 + 5^2 = 9+25 = 34
(不是求「斜邊長」噢,是「斜邊平方」)
直接將 a^2 + b^2 計算結果印出即可。

解法

a = 3
b = 5

print(a**2+b**2) # python的次方不是`^`而是`**`

上一篇
Day02 | Rosalind 生資解題 - INI1. Installing Python
下一篇
Day04 | Rosalind 生資解題 - IN3. Strings and Lists
系列文
Rosalind 生物資訊解題系統7
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言